package authentication.dao;

import java.util.List;


import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import authentication.entiy.Token;


@Repository
public class TokenPersistent {
	
	public SqlSessionTemplate getSqlSessionTemplate() {
		return sqlSessionTemplate;
	}

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	private SqlSessionTemplate sqlSessionTemplate;
	
	public int inertToken( Token token) {
		// TODO Auto-generated method stub
		int re=sqlSessionTemplate.insert("inertToken", token);
		return re;
	}
	public int checkToken( String tokenId) {
		// TODO Auto-generated method stub
		List<Integer> re=sqlSessionTemplate.selectList("checkToken", tokenId);
		return re.get(0);
	}
	public int updateToken( Token token) {
		// TODO Auto-generated method stub
		int re=sqlSessionTemplate.update("updateToken", token);
		return re;
	}
	
}
